<template>
  <div class="page-center">
    <div class="avatar" v-if="userInfo">
      <img :src="userInfo.headIcon" class="avator-icon" />
      <div class="nick-name">{{ userInfo.nickName }}</div>
    </div>

    <div class="avatar" v-else>
      <img src="../../assets/avatar.png" class="avator-icon" />
      <div class="nick-name" @click="$router.push({ name: 'login' })">立即登录</div>
    </div>

    <ul class="my-order-tab">
      <li>
        <div class="value">0张</div>
        <div class="label">卖座券</div>
      </li>
      <li>
        <div class="value">0元</div>
        <div class="label">余额</div>
      </li>
    </ul>

    <VanCellGroup>
      <VanCell title="电影订单" is-link :to="{ name: 'user-order' }"></VanCell>
      <VanCell title="组合红包" is-link :to="{ name: 'user-red' }"></VanCell>
      <VanCell title="历史记录" is-link></VanCell>
      <VanCell title="帮助与客服" is-link></VanCell>
      <VanCell title="设置" is-link></VanCell>
    </VanCellGroup>
  </div>
</template>

<script lang="ts" setup>
import { useUserStore } from '@/stores/user'

const { userInfo } = storeToRefs(useUserStore())
</script>

<style scoped>
.page-center {
  height: 100%;
  background-color: #f4f4f4;
  overflow-y: auto;
}

.avatar {
  box-sizing: border-box;
  text-align: center;
  margin-top: -44px;
  height: 200px;
  padding-left: 22px;
  padding-top: 64px;
  background: url('https://assets.maizuo.com/h5/v5/public/app/img/bg.a5bdd690.png');
  background-size: cover;
  display: flex;
  align-items: center;
  color: #fff;
}

.avator-icon {
  width: 63px;
  height: 63px;
  border-radius: 35px;
  margin-right: 20px;
  border: 2px solid #fff;
}

.nick-name {
  font-size: 16px;
}

.my-order-tab {
  box-sizing: border-box;
  width: 100%;
  margin: 0 auto;
  display: flex;
  text-align: center;
  font-size: 13px;
  padding: 0;
  height: 79px;
  background: #fff;
  margin-bottom: 10px;
  align-items: center;
}

.my-order-tab li {
  flex: 1;
  list-style: none;
}

.my-order-tab .value {
  color: #191a1b;
  font-size: 17px;
}

.my-order-tab .label {
  font-size: 13px;
  color: #797d82;
}
</style>
